﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 汽车
{
    internal class Auto
    {
        protected int tireCount;
        protected string color;
        protected double weight;
        protected double speed;

        public Auto(int tireCount, string color, double weight, double speed)
        {
            this.tireCount = tireCount;
            this.color = color;
            this.weight = weight;
            this.speed = speed;
        }

        public virtual void Accelerate()
        {
            speed += 10;
            Console.WriteLine($"汽车正在加速, 当前速度为: {speed}  km/h");
        }

        public virtual void Decelerate()
        {
            speed -= 10;
            if(speed < 0) speed = 0;
            Console.WriteLine($"汽车正在减速, 当前速度为: {speed}  km/h");
        }

        public void Stop()
        {
            speed = 0;
            Console.WriteLine($"汽车已停止");
        }

    }
}
